﻿using System;
using System.Collections.Generic;
using System.Text;
using ASBCC.Database.Entity;
using ASBCC.Database.Service;
using ASBCC.Workflow.K2Manager;

namespace ASBCC.Workflow.Client
{
    public class EZVisitAppForm : IAppForm
    {
        EZVisitApplicationTableEntity _entity;

        public EZVisitAppForm(EZVisitApplicationTableEntity entity)
        {
            _entity = entity;
        }

        #region IAppForm Members

        public int AppFormId
        {
            get
            {
                return _entity.AppID == null ? 0 : _entity.AppID.Value;
            }
            set
            {
                _entity.AppID = value;
            }
        }

 
        public string CurrentStep
        {
            get
            {
                return _entity.CurrentStep;
            }
            set
            {
                _entity.CurrentStep = value;
            }
        }
        public string CurrentApprover
        {
            get
            {
                return _entity.CurrentApprover;
            }
            set
            {
                _entity.CurrentApprover = value;
            }
        }
        public string Folio
        {
            get
            {
                return _entity.Folio;
            }
            set
            {
                _entity.Folio = value;
            }
        }

        public string AppFormNo
        {
            get
            {
                return _entity.AppNo == null ? "" : _entity.AppNo;
            }
            set
            {
                _entity.AppNo = value;
            }
        }

        public int ProcInstId
        {
            get
            {
                return _entity.ProcInstId ?? 0;
            }
            set
            {
                _entity.ProcInstId = value;
            }
        }

        #region Applicant

        //private K2User _applicant;

        public K2User Applicant
        {
            get
            {
                return new K2User(_entity.RequesterID.Value, _entity.RequesterNameEN, _entity.RequesterNameCN);
            }
        }

        #endregion

        #region Creator

        //private K2User _creator;

        public K2User Creator
        {
            get
            {
                return new K2User(_entity.RequesterID.Value, _entity.RequesterNameEN, _entity.RequesterNameCN);
            }
        }

        #endregion

        public DateTime CreatedDate
        {
            get
            {
                return _entity.CreateAt == null ? DateTime.MinValue : _entity.CreateAt.Value;
            }
            set
            {
                _entity.CreateAt = value;
            }
        }

        public DateTime ModifiedDate
        {
            get
            {
                return _entity.LatestUpdateAt == null ? DateTime.MinValue : _entity.LatestUpdateAt.Value;
            }
            set
            {
                _entity.LatestUpdateAt = value;
            }
        }

        public string ProcessStatus
        {
            get
            {
                return _entity.ProcessStatus;
            }
            set
            {
                _entity.ProcessStatus = value;
            }
        }


        public string Status
        {
            get
            {
                return _entity.Status;
            }
            set
            {
                _entity.Status = value;
            }
        }

        public string Readers
        {
            get
            {
                return _entity.Readers;
            }
            set
            {
                _entity.Readers = value;
            }
        }

        public string FNCController
        {
            get
            {
                return _entity.FNCController;
            }
            set
            {
                _entity.FNCController = value;
            }
        }
        public string DeptHead
        {
            get
            {
                return _entity.DeptHead;
            }
            set
            {
                _entity.DeptHead = value;
            }
        }

        public string PDC
        {
            get
            {
                return _entity.PDC;
            }
            set
            {
                _entity.PDC = value;
            }
        }

        public string CODPPManager
        {
            get
            {
                return _entity.CODPPManager;
            }
            set
            {
                _entity.CODPPManager = value;
            }
        }

        public string CEODelegation
        {
            get
            {
                return _entity.CEODelegation;
            }
            set
            {
                _entity.CEODelegation = value;
            }
        }


        public string CODPPHead
        {
            get
            {
                return _entity.CODPPHead;
            }
            set
            {
                _entity.CODPPHead = value;
            }
        }

        public string LGD
        {
            get
            {
                return _entity.LGD;
            }
            set
            {
                _entity.LGD = value;
            }
        }

        public string LGDCheckPerson
        {
            get
            {
                return _entity.LGDCheckPerson;
            }
            set
            {
                _entity.LGDCheckPerson = value;
            }
        }
        public string PostCODPPHead
        {
            get
            {
                return _entity.PostCODPPHead;
            }
            set
            {
                _entity.PostCODPPHead = value;
            }
        }
        public string PostCODPPManager
        {
            get
            {
                return _entity.PostCODPPManager;
            }
            set
            {
                _entity.PostCODPPManager = value;
            }
        }
        public string FormURL
        {
            get
            {
                return _entity.FormURL;
            }
            set
            {
                _entity.FormURL = value;
            }
        }
  

        public object Entity
        {
            get
            {
                return _entity;
            }
        }

       
        public void SetEntity(EZVisitApplicationTableEntity ezvisit)
        {
            _entity = ezvisit;
        }

        public void UpdateEntity()
        {
            EZVisitApplicationManager.Update(_entity);
        }

        #endregion
    }

    public class EZVisitWorkflowKeyConsts
    {
        public const string Applicant = "Applicant";
        public const string DeptHead = "DeptHead";
        public const string CODPPManagerDone = "CODPPManagerDone";
        public const string PDCDone = "PDCDone";
        public const string CODPPCheckPerson = "CODPPCheckPerson";
        public const string CODPPManager = "CODPPManager";
        public const string LGDCheckPerson = "LGDCheckPerson";
        public const string PDC = "PDC";
    }

    public class EZVisitActivityNameConsts
    {
        public const string FNC_Controller = "FNC Controller";
        public const string Dept_Head = "Dept Head";
        public const string COD_PP_Check_Person = "COD-PP Check Person";
        public const string PDC = "PDC";
        public const string COD_PP_Manager = "COD-PP Manager";
        public const string CEO_Delegation = "CEO Delegation";
        public const string COD_PP_Head = "COD-PP Head";
        public const string LGD = "LGD";
        public const string LGD_Check_Person = "LGD Check Person";

        public const string Post_Submission = "Post Trip";
        public const string Post_COD_PP_Check_Person = "Post COD-PP Check Person";
        public const string Post_Dept_Head = "Post Dept Head";
        public const string Post_COD_PP_Manager = "Post COD-PP Manager";
        public const string Post_COD_PP_Head = "Post COD-PP Head";


    }
}
